home *** CD-ROM | disk | FTP | other *** search
- Path: news.asiaonline.net!usenet
- From: samsona@asiaonline.net (Samson Lin)
- Newsgroups: comp.lang.c++
- Subject: Can't Display PopUp Window
- Date: Sat, 30 Mar 1996 09:01:25 GMT
- Organization: Reader's Digest Far East
- Message-ID: <4jit49$pea@news.asiaonline.net>
- NNTP-Posting-Host: ip101.asiaonline.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi,
-
- I am writing a Window C program. I meet a problem in displaying popup
-
- window.
-
- The program is a quite simple program. It is a phone book to record
- name, address, & tel. no. It has a menu bar with 2 options:
-
- ABOUTMENU MENU
- {
- MENUITEM "Load/Save PhoneBk ", CM_LOAD_SAVE
- MENUITEM "Exit", CM_EXIT
- }
-
- CM_EXIT is for program exit while CM_LOAD_SAVE is for displaying
- another window for file loading & saving. The popup window is
- designed like the popup window after you press "Save as" command in
- Word or Excel.
-
- The followings are the codes for calling the popup window dialog &
- exit under WM_COMMAND, switch statements; as well as the LOAD/SAVE
- dialog
- function "LoadSaveDlgProc":
-
- case CM_LOAD_SAVE:
- {
- FARPROC LoadSaveDlg =
- MakeProcInstance((FARPROC)LoadSaveDlgProc, hInstance);
-
- if (hInstance == NULL)
- MessageBox(hwnd, "MakeProcInstance Failed",
- "DEBUG CM_LOAD_SAVE", MB_OK|MB_ICONEXCLAMATION);
- else
- MessageBox(hwnd, "MakeProcInstance Successful",
- "DEBUG CM_LOAD_SAVE", MB_OK|MB_ICONEXCLAMATION);
-
- DialogBox(hInstance, "SAVEDLG", hwnd, (DLGPROC)LoadSaveDlg);
-
- MessageBox(hwnd, "End of LOAD/SAVE DialogBox execution",
- "DEBUG CM_LOAD_SAVE", MB_OK|MB_ICONEXCLAMATION);
-
- FreeProcInstance(LoadSaveDlg);
- }
- break;
-
- case CM_EXIT:
- {
- DestroyWindow(hwnd);
- }
- break;
- .......
-
- //-------------------------------------------------------------------
- BOOL CALLBACK LoadSaveDlgProc(HWND hDlg, WORD Message,
- WPARAM wParam, LPARAM lParam)
- {
- .......
- }
-
- During the testing period, everything functioned smoothly. I could
- display the LOAD/SAVE popup window by pressing MENUITEM "Load/Save
- PhoneBk" & exit the program normally by pressing MENUITEM "Exit". The
- testing was done during I was in the Borland C++ 4.5 environment.
-
- After the testing, I quitted Borland environment, open File Manager,
- clicked the phone book program line to have it executed. All things
- got normal results.
-
- Immediately, I quitted Windows to dos, & then enter Windows once
- again.
- I opened File Manager & executed the same program. The program still
- ran BUT when I clicked the LOAD/SAVE menuitem, the LOAD/SAVE popup
- window didn't appear! The EXIT menuitem still worked instead.
-
- So I added several MessageBox statements inside the "CM_LOAD_SAVE"
- module and test the program once again. I quitted Window and entered
- once again, repeated the same things. All messages were displayed
- before and after the following statement (shown in the source code
- above, which calls the LOAD/SAVE dialog),
-
- DialogBox(hInstance, "SAVEDLG", hwnd, (DLGPROC)LoadSaveDlg);
-
- but the DialogBox statement didn't execute, i.e. LoadSaveDlg not
- called.
-
- If I repeat the following steps, I can always wake up the LOAD/SAVE
- popup window :
-
- (1) Run Borland C++ IDE
- (2) Run phone book program
-
- OR
-
- (1) Run Borland C++ IDE
- (2) Quit Borland C++ IDE
- (3) Run phone book program
-
- If I don't run Borland C++ beforehand, the program still works but I
- can't see the LOAD/SAVE popup window when I click the LOAD/SAVE menu
- item.
-
- Why the above case happens? My pc configuration is Pentium 100,
- 8MB ram, Chinese Win v3.1 with Win32s.
-
- Samson
- Reader's Digest Asso. Far East
- (samsona@asiaonline.net)
-
-